import pandas
import yaml,csv,json

def read_yaml():
    with open(r'E:\gg4\Auto_wms\Api_A3mall\data\inbound.yaml', encoding='utf-8') as f:
        return yaml.safe_load(f)

def read_csv():
    data = []
    with open(r'E:\gg4\Auto_wms\Api_A3mall\data\inbound.csv', 'r', encoding='utf-8-sig') as f:
        reader = csv.DictReader(f)
        for row in reader:
            data.append(row)
    return data

def read_json():
    with open(r'E:\gg4\Auto_wms\Api_A3mall\data\inbound.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
    return [(i['username'],i['password']) for i in data]

def read_excel():
    data = pandas.read_excel(r'E:\gg4\Auto_wms\Api_A3mall\data\A3mall.xlsx')
    l = []
    for index,row in data.iterrows():
        l.append((row['username'],row['password'],row['exp']))
    return l
# def read_excel(file):
#     return pandas.read_excel(file,engine='openpyxl').to_dict('records')